<?php

namespace app\common\logic;

use app\common\helper\AliOss;
use app\common\model\BaseModel;
use think\exception\HttpResponseException;
use think\Model;

class BaseLogic
{
    protected $model;
    protected $page;
    protected $limit;
    public function __construct()
    {
        $this->model = new BaseModel();
        $this->page = input('page/d',1);
        $this->limit = input('limit/d',15);
        $this->init();
    }

    public function init() {}

    public function add($data)
    {
        $this->model->save($data);
    }

    public function edit($data)
    {
        $obj = $this->model->where("id",$data['id'])->find();
        if (!$obj) throwError();
        $obj->save($data);
    }
}